package robotleMvc.frameworks.dispcontainer
{
	import org.robotlegs.mvcs.Mediator;
	
	import robotleMvc.frameworks.buildEdit.event.BuildEditEvent;
	import robotleMvc.frameworks.glass.GlassEvent;
	import robotleMvc.frameworks.scene3D.event.Scene3DEvent;
	import robotleMvc.frameworks.scene3D.model.Scene3DModel;
	import robotleMvc.ui.dispcontainer.DispcontainerView;

	
	public class DispcontainerMediator extends Mediator
	{
		[Inject]
		public var dispcontainerView:DispcontainerView;
		[Inject]
		public var scene3DModel:Scene3DModel;
		public function DispcontainerMediator()
		{
			super();
		}
		override public function onRegister():void
		{
			this.addContextListener( Scene3DEvent.SEND_GROUND_HEIGHT_BITMAPDATA,sendGroundHeightBitempData);
			this.addViewListener(DispcontainerEvent.CLIK_BUT,clikBut)
			dispcontainerView.groundHightPic.visible=false;
			
			
		}

		
		private function clikBut(dispcontainerEvent:DispcontainerEvent):void
		{
			var evt:DispcontainerEvent=new DispcontainerEvent(DispcontainerEvent.OPEN_TOP_VIEW);
			this.dispatch(evt)
			
			var buildEditEvent:BuildEditEvent=new BuildEditEvent(BuildEditEvent.OPEN_BUILD_EDIT_VIEW)
			//this.dispatch(buildEditEvent);
		
		}

		private function sendGroundHeightBitempData(evt:Scene3DEvent):void
		{
			dispcontainerView.groundHightPic.bitmapData=evt.groundHeightBitmapData;
			dispcontainerView.groundHightPic.scaleX=0.3
			dispcontainerView.groundHightPic.scaleY=0.3
			dispcontainerView.groundHightPic.visible=!dispcontainerView.groundHightPic.visible;
		}
	}
}